Код:
#==============================================================================
# MOG VX - Menu Status Aya v2.0
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Menu Status com layout em pictures.
#==============================================================================
# UTILIZAÇÃO
#
# 1 - Crie uma pasta com o nome de MENUS. (Graphics/Menus)
# 2 - Nesta pasta devem conter as seguintes imagens.
#
# Background.png
# M_Status_Exp_Meter.png
# M_Status_Parameter_Meter.png
# M_Status_HPSP.png
# M_Status_Layout.png
# M_Status_OBJ.png
#
# 3 - Serão necessários as seguintes imagens na pasta SYSTEM. (Graphics/System)
#
# Number_01.png
# Number_01_B.png
#
#==============================================================================
# Histórico
# 1.1 Melhor codificação e novos efeitos.
#==============================================================================
module MOG_VX07
#Definição do parameter maximo.
MAX_PARAMETER = 999
end
#===============================================================================
# ● Game_Actor
#===============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● now_exp
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# ● next_exp
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#===============================================================================
# Cache
#===============================================================================
module Cache
#--------------------------------------------------------------------------
# ● menu
#--------------------------------------------------------------------------
def self.menu(filename)
load_bitmap("Graphics/Menus/", filename)
end
end
#===============================================================================
# ● Window_Base
#===============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)
#--------------------------------------------------------------------------
# X - Posição na horizontal
# Y - Posição na vertical
# VALUE - Valor Numérico
# FILE_NAME - Nome do arquivo
# ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita
# SPACE - Espaço entre os números.
# FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
# FRAME_INDEX - Definição do quadro a ser utilizado.
#--------------------------------------------------------------------------
def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)
number_image = Cache.system(file_name)
frame_max = 1 if frame_max < 1
frame_index = frame_max -1 if frame_index > frame_max -1
align = 2 if align > 2
cw = number_image.width / 10
ch = number_image.height / frame_max
h = ch * frame_index
number = value.abs.to_s.split(//)
case align
when 0
plus_x = (-cw + space) * number.size
when 1
plus_x = (-cw + space) * number.size
plus_x /= 2
when 2
plus_x = 0
end
for r in 0..number.size - 1
number_abs = number[r].to_i
number_rect = Rect.new(cw * number_abs, h, cw, ch)
self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)
end
number_image.dispose
end
#--------------------------------------------------------------------------
# ● draw_actor_parameter_meter
#--------------------------------------------------------------------------
def draw_actor_parameter_meter(actor, x, y,type)
image = Cache.menu("M_Status_Parameter_Meter")
cw = image.width
ch = image.height / 2
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y, image, src_rect)
case type
when 0
value = actor.atk
when 1
value = actor.def
when 2
value = actor.spi
when 3
value = actor.agi
end
cw = image.width * value / MOG_VX07::MAX_PARAMETER
src_rect = Rect.new(0, ch, cw, ch)
self.contents.blt(x , y , image, src_rect)
draw_picture_number(x + image.width ,y - 22 ,value, "Number_01",0, 0,3,0)
image.dispose
end
#--------------------------------------------------------------------------
# ● draw_item_name_menu_status
#--------------------------------------------------------------------------
def draw_item_name_menu_status(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 30, y, 155, WLH, item.name)
end
end
#--------------------------------------------------------------------------
# ● draw_equipments_menu_status
#--------------------------------------------------------------------------
def draw_equipments_menu_status(actor, x, y)
draw_item_name_menu_status(actor.equips[0], x , y)
draw_item_name_menu_status(actor.equips[1], x , y + 45)
draw_item_name_menu_status(actor.equips[2], x , y + 90)
draw_item_name_menu_status(actor.equips[3], x + 125, y + 20)
draw_item_name_menu_status(actor.equips[4], x + 125, y + 65)
end
#--------------------------------------------------------------------------
# ● draw_actor_hp_menu_status
#--------------------------------------------------------------------------
def draw_actor_hp_menu_status(actor, x, y)
image = Cache.menu("M_Status_HPSP")
cw = image.width * actor.hp / actor.maxhp
ch = image.height / 2
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch + 30, image, src_rect)
draw_picture_number(x + 35 ,y + image.height, actor.hp, "Number_01_B",0, 10,3,1)
draw_picture_number(x + 95 ,y + image.height , actor.maxhp, "Number_01_B",0, 10,3,1)
image.dispose
end
#--------------------------------------------------------------------------
# ● draw_actor_mp_menu_status
#--------------------------------------------------------------------------
def draw_actor_mp_menu_status(actor, x, y)
image = Cache.menu("M_Status_HPSP")
cw = image.width * actor.mp / actor.maxmp
ch = image.height / 2
src_rect = Rect.new(0, ch, cw, ch)
self.contents.blt(x , y - ch + 30, image, src_rect)
draw_picture_number(x + 35 ,y + image.height, actor.mp, "Number_01_B",0, 10,3,2)
draw_picture_number(x + 95 ,y + image.height , actor.maxmp, "Number_01_B",0, 10,3,2)
image.dispose
end
#--------------------------------------------------------------------------
# ● draw_menu_status_obj
#--------------------------------------------------------------------------
def draw_menu_status_obj(x,y)
image = Cache.menu("M_Status_OBJ")
cw = image.width
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, image, src_rect)
image.dispose
end
#--------------------------------------------------------------------------
# ● draw_actor_exp_meter_status_menu
#--------------------------------------------------------------------------
def draw_actor_exp_meter_status_menu(actor, x, y)
rate = actor.now_exp.to_f / actor.next_exp
rate = 1 if actor.next_exp == 0
image = Cache.menu("M_Status_Exp_Meter")
cw = image.width
ch = image.height / 2
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y , image, src_rect)
cw = image.width * rate
cw = image.width if actor.level == 99
src_rect = Rect.new(0, ch, cw, ch)
self.contents.blt(x , y , image, src_rect)
if actor.next_exp != 0
self.contents.draw_text(x + 30, y - 20, 80, 32, actor.next_rest_exp_s, 2)
else
self.contents.draw_text(x + 30, y - 20, 80, 32, "Max", 2)
end
self.contents.draw_text(x - 30, y + 10, 120, 32, actor.exp_s.to_s, 2)
image.dispose
end
end
#===============================================================================
# ● Window_Status_Left
#===============================================================================
class Window_Status_Left < Window_Base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 560, 430)
@actor = actor
self.opacity = 0
self.contents.font.size = 16
self.contents.font.bold = true
self.contents.font.name = "Georgia"
refresh
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(350, 195, 90, 32, @actor.class.name, 1)
draw_actor_face(@actor, 350, 90)
draw_picture_number(500 ,195 , @actor.level, "Number_01",1, 0,3,0)
draw_actor_hp_menu_status(@actor, 350, 213)
draw_actor_mp_menu_status(@actor, 380, 240)
draw_actor_exp_meter_status_menu(@actor, 350, 300)
draw_actor_parameter_meter(@actor, 50, 200,0)
draw_actor_parameter_meter(@actor, 70, 230,1)
draw_actor_parameter_meter(@actor, 90, 260,2)
draw_actor_parameter_meter(@actor, 110, 290,3)
draw_equipments_menu_status(@actor, 30, 40)
draw_actor_state(@actor,190, 320)
end
end
#===============================================================================
# Window_Status_Right
#===============================================================================
class Window_Status_Right < Window_Base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 560, 430)
@actor = actor
self.opacity = 0
self.contents.font.size = 16
self.contents.font.bold = true
self.contents.font.name = "Georgia"
refresh
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 55, 367)
draw_menu_status_obj(0, 380)
end
end
#===============================================================================
# Scene_Status
#===============================================================================
class Scene_Status < Scene_Base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# ● start
#--------------------------------------------------------------------------
def start
super
@actor = $game_party.members[@actor_index]
@status_window_right = Window_Status_Right.new(@actor)
@status_window_right.x = 544
@status_window_right.contents_opacity = 0
@status_window_left = Window_Status_Left.new(@actor)
@status_window_left.x = -544
@status_window_left.contents_opacity = 0
@menu_back = Plane.new
@menu_back.bitmap = Cache.menu("Background")
@menu_layout = Sprite.new
@menu_layout.bitmap = Cache.menu("M_Status_Layout")
end
#--------------------------------------------------------------------------
# ● perform_transition
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(0)
end
#--------------------------------------------------------------------------
# ● pre_terminate
#--------------------------------------------------------------------------
def pre_terminate
super
for i in 0..25
@status_window_right.x += 25
@status_window_left.x -= 25
@status_window_right.contents_opacity -= 15
@status_window_left.contents_opacity -= 15
@menu_back.ox += 1
Graphics.update
end
end
#--------------------------------------------------------------------------
# ● terminate
#--------------------------------------------------------------------------
def terminate
super
@status_window_right.dispose
@status_window_left.dispose
@menu_back.bitmap.dispose
@menu_back.dispose
@menu_layout.bitmap.dispose
@menu_layout.dispose
end
#--------------------------------------------------------------------------
# ● return_scene
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(3)
end
#--------------------------------------------------------------------------
# ● next_actor
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Status.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● prev_actor
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Status.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● update
#--------------------------------------------------------------------------
def update
@status_window_right.update
update_slide
update_command
super
end
#--------------------------------------------------------------------------
# ● update_slide
#--------------------------------------------------------------------------
def update_slide
@menu_back.ox += 1
@status_window_right.contents_opacity += 10
@status_window_left.contents_opacity += 10
if @status_window_right.x > 0
@status_window_right.x -= 25
elsif @status_window_right.x <= 0
@status_window_right.x = 0
@status_window_right.contents_opacity = 255
end
if @status_window_left.x < 0
@status_window_left.x += 25
elsif @status_window_left.x >=
@status_window_left.x = 0
@status_window_left.contents_opacity = 255
end
end
#--------------------------------------------------------------------------
# ● update_command
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
Sound.play_cursor
prev_actor
end
end
end
$mog_rgssvx_scene_status = true
Социальные закладки